package math2;

import fem2.NotImplementedError;

/**
 * B-spline basis function based on Cox-de Boor formula
 * 
 * TODO: to be implemented
 * 
 * @author hbui
 * 
 */
public class BsplineFB extends PolynomialBasisOnRnToR {

	private int p;
	private double[] knots;

	/**
	 * 
	 * @param p
	 *            degree of the curve
	 * @param knots
	 *            knot vector
	 */
	public BsplineFB(int p, double... knots) {
		if (knots.length < p + 1) {
			throw new Error("knot vector length is not sufficient");
		}
		this.p = p;
		this.knots = knots;
	}

	// private void createBasis(int p, double[] knots) {
	// throw new NotImplementedError();
	// }
	//
	// private void createFunction(int i, int p, double[] knots) {
	// throw new NotImplementedError();
	// }

	@Override
	public int getP() {
		return p;
	}

	@Override
	public void setP(int p) {
		throw new NotImplementedError();
	}

	@Override
	public Object clone() {
		return new BsplineFB(p, knots.clone());
	}

}
